<?php
App::uses('AppController', 'Controller');

class //nameClass//Controller extends AppController {

//uses//

	public function index() {        
		$this->//nameClass_Singularize//->recursive = 0;
        $this->set('cakeDescription','Boletas');
        $this->set('title_for_layout','//nameCaption// Inicio');
		$this->set('//nameclass//', $this->paginate());
        $this->set('menu', '//menu//');
        $this->set('submenu', '//menuitem//');
	}

	public function view($id = null) {
        $this->set('cakeDescription','Boletas');
        $this->set('title_for_layout','//nameCaption// Ver');
		$this->//nameClass_Singularize//->id = $id;
		if (!$this->//nameClass_Singularize//->exists()) {
			throw new NotFoundException(__('Invalid news'));
		}
		$this->set('//nameclass_singularize//', $this->//nameClass_Singularize//->read(null, $id));
        $this->set('menu', '//menu//');
        $this->set('submenu', '//menuitem//');
	}

	public function add() {    
        $this->set('cakeDescription','Boletas');
        $this->set('title_for_layout','//nameCaption// Agregar');
        //textfield_reference//
		if ($this->request->is('post')) {
			$this->//nameClass_Singularize//->create();
			if ($this->//nameClass_Singularize//->save($this->request->data)) {
				$this->Session->setFlash(__('The news has been saved'));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The news could not be saved. Please, try again.'));
			}
		}
        $this->set('menu', '//menu//');
        $this->set('submenu', '//menuitem//');
	}

	public function edit($id = null) {
        $this->set('cakeDescription','Boletas');
        $this->set('title_for_layout','//nameCaption// Editar');
        //textfield_reference//
		$this->//nameClass_Singularize//->id = $id;
		if (!$this->//nameClass_Singularize//->exists()) {
			throw new NotFoundException(__('Invalid news'));
		}
		if ($this->request->is('post') || $this->request->is('put')) {
			if ($this->//nameClass_Singularize//->save($this->request->data)) {
				$this->Session->setFlash(__('The news has been saved'));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The news could not be saved. Please, try again.'));
			}
		} else {
			$this->request->data = $this->//nameClass_Singularize//->read(null, $id);
		}
        $this->set('menu', '//menu//');
        $this->set('submenu', '//menuitem//');
	}

	public function delete($id = null) {
		if (!$this->request->is('post')) {
			throw new MethodNotAllowedException();
		}
		$this->//nameClass_Singularize//->id = $id;
		if (!$this->//nameClass_Singularize//->exists()) {
			throw new NotFoundException(__('Invalid news'));
		}
		if ($this->//nameClass_Singularize//->delete()) {
			$this->Session->setFlash(__('News deleted'));
			$this->redirect(array('action' => 'index'));
		}
		$this->Session->setFlash(__('News was not deleted'));
		$this->redirect(array('action' => 'index'));
	}
    
    //views_str//
}